﻿using FastIOC;
using FastIOC.Builder;
using FastIOC.Proxy;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Test.DBTest;
using Test.ServiceTest;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            var container = ContainerBuilder.GetInstance();
            //container.RegisterType<Movie>().EnableInterfaceInterceptors().InterceptedBy<MoveIntercept>().UseAttributeIntercept();

            container.RegisterType<WebCatch>().As<ICatch>().EnableIntercept(); ;
            //container.RegisterType<DBCatch>().As<ICatch>();
            //container.RegisterType<SQLServerCatch>().AsImplementedInterfaces();
            //container.RegisterType<MySQLCatch>().Named<ICatch>("MySQLCatch").EnableInterfaceInterceptors().InterceptedBy<DefaultIntercept>();
            //container.RegisterType<MySQLCatch>().Named<ICatch>("MySQLCatch").EnableInterfaceInterceptors().InterceptedBy<DefaultIntercept>().UseAttributeIntercept();
            //container.RegisterType<OracleCatch>().Named<ICatch>("OracleCatch");
            //container.RegisterType<TransitionalMovie>().EnableIntercept();
            //container.RegisterAssemblyTypes(AppDomain.CurrentDomain.GetAssemblies(), typeof(IBase)).AsImplementedInterfaces().EnableInterfaceInterceptors().InterceptedBy<DefaultIntercept>();

            //container.RegisterType<ModuleService>().AsImplementedInterfaces().EnableInterfaceInterceptors().InterceptedBy<DefaultIntercept>();

            container.Build();

            //TransitionalMovie tm = container.Resolve<TransitionalMovie>();
            //tm.Test1();
            //string result = tm.Test2();
            //Console.WriteLine(result);
            //tm.Test3("世界第一等");


            //TransitionalMovieProxy tm = new TransitionalMovieProxy();
            //tm.Test1();
            //string result = tm.Test2();
            //Console.WriteLine(result);
            //tm.Test3("世界第一等");

            //Movie movie = container.Resolve<Movie>();
            //movie.MovieName = "1111";
            //movie.Test();
            //movie.Test1<MySQLCatch>().SaveCatch();



            ICatch catchtest = container.Resolve<ICatch>();
            catchtest.Catch("Catch111111");
            //catchtest = container.ResolveNamed<ICatch>("MySQLCatch");
            //catchtest.Catch("Catch222222");
            //string result  = catchtest.SaveCatch();
            //Console.WriteLine("saveresult:" + result);
            //IUser userservice = container.Resolve<IUser>();
            //userservice.Say();
            //IModule module = container.Resolve<IModule>();
            //ModuleArgs modulearg = new ModuleArgs();
            //ModuleResult moduleresult = module.Add(modulearg);
            //Console.WriteLine(moduleresult.AddDate);
            Console.WriteLine("Finish");
            Console.ReadKey();
        }
    }
}
